using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;

using ShopPowerTemplate.IoC;
using ShopPowerTemplate.Entities;
using ShopPowerTemplate.Services.Tests.Properties;

namespace ShopPowerTemplate.Services.Tests
{
    public partial class OrderDetailServiceUtil
    {
	
		static internal IOrderDetailService CreateOrderDetailService()
        {
            IOrderDetailService target = IoCFactory.Resolve<IOrderDetailService>();
            return target;
        }
				#region OrderDetail Test
 
        

		public static OrderDetail CreateOrderDetail()
        {
            OrderDetail result = GetOrderDetail();
            IOrderDetailService service = CreateOrderDetailService();
			service.Add(result);

			result = service.Find(result.Id);
            return result;
        }
		
		public static OrderDetail CreateOrderDetailFull()
        {
            OrderDetail result = GetOrderDetailFull();
            IOrderDetailService service = CreateOrderDetailService();
			service.Add(result);

			result = service.Find(result.Id);
            return result;
        }
				
        public static OrderDetail GetOrderDetail()
        {
            OrderDetail result = new OrderDetail();
			
            result.Quantity = 1;


            result.Price = Math.Round(((decimal)new Random().NextDouble()), 2, MidpointRounding.ToEven);


            result.Tax = Math.Round(((decimal)new Random().NextDouble()), 2, MidpointRounding.ToEven);


        	result.Order = OrderServiceUtil.CreateOrder(); 

        	result.ProductDetail = ProductDetailServiceUtil.CreateProductDetail(); 
 
            return result;
            
        }
		
        public static OrderDetail GetOrderDetailFull()
        {
            OrderDetail result = GetOrderDetail();
            
            result.Discount = Math.Round(((decimal)new Random().NextDouble()), 2, MidpointRounding.ToEven);

 
            return result;
            
        }
		
		#endregion OrderDetail Test
	

	}
}
